package com.GraduationDesign.backend.controller.project;

import com.GraduationDesign.backend.bl.project.ProjectService;
import com.GraduationDesign.backend.po.Project;
import com.GraduationDesign.backend.vo.ProjectVO;
import com.GraduationDesign.backend.vo.ResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: wzx
 * @date: 2022/3/20
 */
@RestController
@RequestMapping("api/project")
public class ProjectController {

    @Autowired
    ProjectService projectService;

    @PostMapping("/add_project")
    public ResponseVO addProject(@RequestBody ProjectVO projectVO){
       return projectService.addProject(projectVO);
    }

    @PostMapping("/delete_project")
    public ResponseVO deleteProject(@RequestParam("projectId") int projectId){
        return projectService.deleteProject(projectId);
    }

    @GetMapping("/get_project_list")
    public ResponseVO getProjects(@RequestParam("userId") int userId){

        return ResponseVO.buildSuccess(projectService.getProjects(userId));
    }



}
